跳到主要内容

通过 Nginx 反响代理服务请求出现 413

在使用 Gitea 服务时,一次性上传整个仓库文件,提示错误信息为:

error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413

通过简单的排查,发现并不是应用服务器的问题,而是在 nginx 的 ngx_http_core_module 模块里,client_max_body_size 莫热门值为 1m,因此需要简单的进行更改:

server {
listen 80;
server_name git.xx.xx;
client_max_body_size 100M;
// ...
}

还有两个值也比较常用:

  • client_header_timeout,读取 header 超时时间,默认为60s。
  • client_body_timeout, 读取 body 超时时间,默认为60s。